//
//  ZJBaseTableViewController.m
//  Weibo29
//
//  Created by 曾静 on 16/6/28.
//  Copyright © 2016年 qq. All rights reserved.
//

#import "ZJBaseTableViewController.h"
#import "ZJVisitorView.h"
#import "ZJOAuthViewController.h"
#import "ZJBaseNavViewController.h"
@interface ZJBaseTableViewController ()

@end

@implementation ZJBaseTableViewController


-(void)loadView{
   
    self.isLogin = NO;
    
    if (self.isLogin) {
        
        [super loadView];

    }else{
        
        //设置访客视图
        //父类创建了visitorView但是是在loadView的里面,子类想要使用就得在loadView之后,如果写在loadView,就会先执行子类的loadView方法,但是visitorView还没创建出来,因为先调用子类的loadView方法在调用该父类的方法
        self.visitorView = [[ZJVisitorView alloc]init];
        
        self.view = self.visitorView;
        
    }
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    

    
     [self setNav];
}
-(void)setNav{
    
    self.navigationItem.leftBarButtonItem =  [[UIBarButtonItem alloc]initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(loginBtnClick)];
    
    self.navigationItem.rightBarButtonItem  = [[UIBarButtonItem alloc]initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(registerBtnCilck)];
}

-(void)loginBtnClick{
    
    ZJOAuthViewController *ovc = [[ZJOAuthViewController alloc]init];
    
    ZJBaseNavViewController *nav = [[ZJBaseNavViewController alloc]initWithRootViewController:ovc];
    
    [self presentViewController:nav animated:YES completion:nil];
    
    
}

-(void)registerBtnCilck{
    
    NSLog(@"注册咯");
    
    ZJOAuthViewController *ovc = [[ZJOAuthViewController alloc]init];
    
    ZJBaseNavViewController *nav = [[ZJBaseNavViewController alloc]initWithRootViewController:ovc];
    
    [self presentViewController:nav animated:YES completion:nil];

    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//#warning Incomplete implementation, return the number of sections
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//#warning Incomplete implementation, return the number of rows
    return 0;
}

/*
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath];
    
    // Configure the cell...
    
    return cell;
}
*/


@end
